#ifndef BINARY_SVM__H__
#define BINARY_SVM__H__
#include "Macros.h"

class BinarySVM{
private:
	double Threshold, m_C;
	
	int NumChanged;
	int examineAll;
	
	int m_NumOfNoneOC; // non zero and non C alpha
	
	//save value
	double m_sigma;
	double bValue;
	int m_NumOfVectors;
	double *m_Coefs;
	int *m_Targets;
	double *m_SVMOutputs;
	//end save value
	
	CTrainVector *m_ArrayVec1;
	int m_numOfVec1;
	
	CTrainVector *m_ArrayVec2;
	int m_numOfVec2;
public:
	BinarySVM():m_sigma(0),bValue(0),m_NumOfVectors(0){
		m_Coefs = 0;
		m_Targets = 0;
		m_SVMOutputs = 0;
	}
	void InitData(CTrainVector *arrayVec1, int numOfVec1, CTrainVector *arrayVec2, int numOfVec2);
	void Init(CTrainVector *arrayVec1, int numOfVec1, CTrainVector *arrayVec2, int numOfVec2, double sigma, double C );
	double TrainingKernel(int i, int j);
	// void SMOTraining(double sigma, double C);
	void SMOTraining();
	int examineExample(int i2);
	int takeStep(int i1, int i2);
	double kernel_func(int i1, int i2);
	double kernel_func(int i, float *xVec, int n);
	int classify(float *xVec, int n);
	void SaveToFilePointer(FILE *pFile);
	void LoadFormFilePointer(FILE *pFile);
	void FreeMemory();
};
#endif //BINARY_SVM__H__
